﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace EditorialAdministration
{
	public partial class UnableIconControl : UserControl
	{
		public UnableIconControl()
		{
			// Required to initialize variables
			InitializeComponent();
		}

        public static readonly DependencyProperty AppNameProperty = DependencyProperty.Register("AppName", typeof(string), typeof(UnableIconControl), new PropertyMetadata(AppNameChanged));

        public static void AppNameChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            UnableIconControl control = (UnableIconControl)sender;
            control.lblName.Text = (string)e.NewValue;

        }
        public string AppName
        {
            get
            {
                return (string)this.GetValue(UnableIconControl.AppNameProperty);
            }
            set
            {
                this.SetValue(UnableIconControl.AppNameProperty, value);
            }
        }

        private void UserControl_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
        	// TODO: Add event handler implementation her
            VisualStateManager.GoToState(this, "MouseOver", true);
        }

        private void UserControl_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
        {
        	// TODO: Add event handler implementation here.
            VisualStateManager.GoToState(this, "Base", true);
        }

        private void UserControl_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            string script = string.Format(@"UpdateAppDetailsWithRA('{0}');", this.AppName);
            HtmlPage.Window.Eval(script);
        }
	}
}